package com.hotel.suqiang.dingdonegurad.utils;

import android.content.Context;
import android.content.pm.PackageManager;

/**
 * Created by suqiang on 17/5/23.
 */
public  class PackageUtils {

    public static String getVersionCode(Context context){
        PackageManager packageManager = context.getPackageManager();

        String versionCode = "";
        try {
            versionCode = packageManager.getPackageInfo(context.getPackageName(), 0).versionCode + "";
        } catch (PackageManager.NameNotFoundException e) {
            e.printStackTrace();
        }

        return versionCode;
    }


    public static String getVersionName(Context context){
        PackageManager packageManager = context.getPackageManager();

        String versionName = "";
        try {
            versionName = packageManager.getPackageInfo(context.getPackageName(), 0).versionName;
        } catch (PackageManager.NameNotFoundException e) {
            e.printStackTrace();
        }

        return versionName;
    }

}
